var allId = [];
/****************************************************************************/
function initTopTree() {
	mjyTime();
	MenuTreeService.getFirstMenu("0", id, false, doTopTree);
	//显示预警信息提示框
	//Messager.showMessager();
	
}
function doTopTree(data) {
	var str = "";
	var length = data.length;
	for (var i = 0; i < length; i++) {
		allId[allId.length] = false;
		if (data[i].bigImage == null) {
			str += "<a href='#' onclick=\"initMyTree('" + data[i].smId + "','" + id + "'," + i + ",'" + data[i].smName + "')\" id=\"" + data[i].smId + "\" hidefocus=true>"+
			"<img  src=\"" + basePath + "homepage/menu/images/big-Ico/sy.png\">"+
			"<div id='" + i + "' style='line-height:150%; font-size:12px; text-align:center; font-weight:bold;' onclick=\"initMyTree('" + data[i].smId + "','" + id + "'," + i + ",'" + data[i].smName + "')\">"+
			"<font id='" + i + "c" + "' align='center' color=''>" + data[i].smName + "</font></div></a>";
		} else {
			str += "<a href='#' onclick=\"initMyTree('" + data[i].smId + "','" + id + "'," + i + ",'" + data[i].smName + "')\" id=\"" + data[i].smId + "\" hidefocus=true><img src=\"" + basePath + "sources/images/" + data[i].bigImage + "\"><div id='" + i + "' style='line-height:150%; font-size:12px; text-align:center; font-weight:bold;' onclick=\"initMyTree('" + data[i].smId + "','" + id + "'," + i + ",'" + data[i].smName + "')\"><font align='center' color=''>" + data[i].smName + "</font></div></a>";
		}
	}
	nowname = data[0].smName;
	document.getElementById("toptree").innerHTML = str;
	allId[0] = true;
	initMyTree(data[0].smId, id, 0, data[0].smName);
}
//导航TREE点击事件
function initMyTree(treeid, userid, id, name) {
	window.frames["iframeid"].initMyTree(treeid, userid,id);
	for (var i = 0; i < allId.length; i++) {
		if (allId[i] && i != id) {
			allId[i] = false;
			document.getElementById(i).innerHTML = "<font color=''>" + nowname + "</font>";
		}
	}
	allId[id] = true;
	nowname = name;
	document.getElementById(id).innerHTML = "<font color='#bde9f5'>" + name + "</font>";
}
/****************************************************************************/
function skipUrl(url){
	window.frames['iframeid'].skipUrl(url);
}
function TuneHeight() {   
	var frm = document.getElementById("iframeid");
	var subWeb = document.frames ? document.frames["iframeid"].document : frm.contentDocument; 
	if(frm != null && subWeb != null) {
		var clientHeight = document.documentElement.clientHeight;
		frm.height = clientHeight-92;
		return clientHeight - 104;
	}
}
function mjyTime(){
    var today=new Date()
    var a=today.getFullYear()
	var b=today.getMonth()+1
	var c=today.getDate()
    var d=today.getHours()
    var e=today.getMinutes()
    var f=today.getSeconds()
	var g=today.getDay()
    b=check(b)
    c=check(c)
    d=check(d)
    e=check(e)
    f=check(f)
    document.getElementById('date').innerHTML=a+"年"+b+"月"+c+"日&nbsp;&nbsp;"+d+":"+e+":"+f;
    t=setTimeout('mjyTime()',500)
}
function check(i)
{
	if (i<10) 
	{i="0" + i}
	return i
}
function addTabPanel(title,html,image,id){
	window.frames["iframeid"].addTabPanel(title,html,image,id);
}
function showLeftInfo(num){
	parent.frames["iframeid"].initMyTree(num);
}